<?php
//<form enctype="multipart/form-data" method="post" name="uploadfile"><input type="file" name="upfile" /><input type="submit" value="submit" /></form> 
$fileItem=$_FILES['upfile'];
if($fileItem){
	$name=$fileItem->getName();
	$json['filename'] = $name;
	$content=$fileItem->getContent();
	$picService = $PicServiceFactory->getPicService();
	$response=$picService->savePic("/比赛图片",$name,$content);
	if($response->isSuccess()){
		$json['success'] = true;
		$json['errorMsg'] = 'no error';
		$json['img']['filename'] = $response->getResult()->filename;
		$json['img']['dirpath'] = $response->getResult()->dirpath;
		$json['img']['size'] = $response->getResult()->size;
		$json['img']['md5'] = $response->getResult()->md5;
		$json['img']['type'] = $response->getResult()->type;
		$json['img']['url'] = $response->getResult()->fullUrl;
		// $json['img']['cdn_url'] = $response->getResult()->getCDNFullUrl(30,30);
		$json['img']['modified'] = $response->getResult()->fileModified;
		$json['status'] = $response->getStatus();
	} else {
		$json['sucess'] = false;
		$json['errorMsg'] = $response->getErrorMsg();
	}
}else{
	$json['sucess'] = false;
	$json['errorMsg'] = "没有上传文件";
}
echo json_encode($json);
?>